package com.rent.rent_back_end.service.Impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.rent.rent_back_end.dao.PostsDao;
import com.rent.rent_back_end.domain.Posts;
import com.rent.rent_back_end.service.PostsService;
import org.apache.logging.log4j.util.Strings;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: 王榄
 * @Date: 2023/02/06/12:33
 * @Description:
 */
@Service
public class PostsServiceImpl extends ServiceImpl<PostsDao, Posts> implements PostsService {
    @Autowired
    private PostsDao postsDao;

    @Override
    public List<Posts> selectByCondition(String postAddress, String postName) {
        LambdaQueryWrapper<Posts> lqw = new LambdaQueryWrapper<>();
        lqw.like(true,Posts::getPostAddress,postAddress);
        lqw.like(true,Posts::getPostName,postName);
        List<Posts> posts = postsDao.selectList(lqw);
        return posts;
    }

    @Override
    public Posts selectById(Integer postId) {
        return postsDao.selectById(postId);
    }
}
